<template>
<h1>OA审批</h1>
<ul style="list-style-type: none;display: inline-flex;width: 800px;">
  <li v-for="(item, index) in workflowlist" :key="index" style="margin-left: 60px;width: 100px;cursor: pointer;" @click = "toworkflow(item.workflow_id)"> 
    <img src="../../assets/icon (2).png" style="width: 30px; height: 30px;vertical-align: middle;">
    {{ item.workflow_name }}
  </li>
</ul>

<!-- <div v-for="item in task_list" >您的{{item.workflow_name}}{{item.get_task_status_display}}</div> -->

</template>

<script setup>
import http from "../../http";  
import { ref, onMounted } from 'vue';
import { ElMessage } from 'element-plus';
import axios from 'axios';
import { useRouter } from 'vue-router';
const router = useRouter();
// 查看可申请的工作流
let role_id=ref()
let role=ref()
let userid=ref()
let workflowlist=ref([])
const toworkflow=(id)=>{
  console.log(id)
    router.push({path:"/workflow_one",query:{id:id}})
}

const getworkflowlist=()=>{
  http.get(`/app/workflow_role/${role_id.value}/get_per/`)
  .then(res=>{
    workflowlist.value = res.data.data
  })
}
// 展示正在进行的任务
// let task_list=ref([])
// 	const get_task=()=>{
// 		axios.get(`http://127.0.0.1:8000/app/task/?staffid=${userid}`)
// 		.then(res=>{
// 			console.log(res)
// 			task_list.value=res.data
// 		})
// 		}
onMounted(
    ()=>{
      userid.value = localStorage.getItem("userid")
      role_id.value = JSON.parse(localStorage.getItem('roleid'))
      getworkflowlist()
      // get_task()
    }
)
</script>

<style>

</style>
